use serde::Deserialize;


// 使用 include_str! 将文件内容直接嵌入到代码中
const SETTINGS: &str = include_str!("../src/Settings.toml");

#[derive(Debug, Deserialize)]
pub(crate) struct Settings {
    pub database: DatabaseSettings,
}

#[derive(Debug, Deserialize)]
pub struct DatabaseSettings {
    pub mysql_rust_usl: String,
}

impl Settings {
    pub(crate) fn new() -> Result<Settings, toml::de::Error> {
        // 函数来解析嵌入的TOML字符串到Config对象
        toml::from_str(SETTINGS)
    }
}